<?php
/**
 * Created by PhpStorm.
 * User: van404
 * Date: 2017/7/16
 * Time: 10:07
 */

namespace Van\ServiceProvider;


use Psr\Container\ContainerInterface;

class SettingServiceProvider
{

    /**
     * @var ContainerInterface
     */
    protected $app;

    /**
     * Registers services on the given container.
     *
     * This method should only be used to configure services and parameters.
     * It should not get services.
     *
     * @param ContainerInterface $pimple A container instance
     */
    public function register(ContainerInterface $pimple)
    {
        $this->app = $pimple;

        $pimple['files'] = function () use ($pimple) {

            return $this->initFiles();
        };
    }

    private function initFiles()
    {
        return array(
            'headers' => $this->getHeaders(),
            'forms' => $this->getForms()
        );
    }

    private function getHeaders()
    {
        return file_get_contents($this->getConfigDir() . 'headers.txt');
    }

    private function getForms()
    {
        return file_get_contents($this->getConfigDir() . 'forms.txt');
    }

    private function getConfigDir()
    {
        return APP_ROOT . '/config/';
    }
}